package basic.com.liz.learn.design.observer;

import java.util.Enumeration;
import java.util.Vector;

public abstract class AbstractSubject implements Subject
{
    Vector<Observer> vector = new Vector<Observer>();
    
    @Override
    public void add(Observer o)
    {
        vector.add(o);
    }
    
    @Override
    public void delete(Observer o)
    {
        vector.remove(o);
    }
    
    @Override
    public void notifyAllObservers()
    {
        Enumeration<Observer> enumo = vector.elements();
        while (enumo.hasMoreElements())
        {
            enumo.nextElement().update();
        }
    }
    
    @Override
    public void operation()
    {
    }
    
}
